import { Router } from '@angular/router';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.css']
})
export class MenuComponent implements OnInit {

  menus:Array<Menu>;
  currentmenuId:number =1;
  constructor(private routerInfo:Router) { }

  ngOnInit() {
    this.menus = [
      new Menu(1,'/dashboard','首页'),
      new Menu(2,'/stock','股票管理')
    ]
  }

  nav(menu:Menu){
    this.routerInfo.navigateByUrl(menu.link);
    this.currentmenuId = menu.id;
  }

}
export class Menu{
  constructor(public id:number,public link:string,public name:string){}
}
